package com.aegean.CommercialHotelBookSystem.shop.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.aegean.CommercialHotelBookSystem.model.Customer;
import com.aegean.CommercialHotelBookSystem.model.Room;

/**
 * Servlet implementation class ShopBooksTide
 */
public class ShopBooksTide extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public ShopBooksTide() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		Customer customer = (Customer) session.getAttribute("Login_User");
		ArrayList<Room> ShopCar=null;
		HashMap<Customer, ArrayList<Room>> BuyCar = (HashMap<Customer, ArrayList<Room>>) session
				.getAttribute("Shop_BookRooms");
		if (BuyCar==null) {
		} else {
			ShopCar = BuyCar.get(customer);
		}
		session.setAttribute("Shop_BuyCar", ShopCar);
		request.getRequestDispatcher("Shop_Books.jsp").forward(request,
				response);
	}
}
